package com.tdam2013.grupo12.webMessaging;

import java.util.Calendar;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.TaskStackBuilder;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;

import com.tdam2013.grupo12.R;
import com.tdam2013.grupo12.broadcastReceiver.InformacionRed;

public class Notificacion {
	
	public static void generarNotificacion(Context context, int idNotificacion, String textoAMostrar, String titulo){
		
		String ns = context.NOTIFICATION_SERVICE;
		NotificationManager nm = (NotificationManager) context.getSystemService(ns);
		Notification notification = new Notification();
		String status = InformacionRed.getConnectivityStatusString(context);
		NotificationCompat.Builder mBuilder =  new NotificationCompat.Builder(context)
        .setSmallIcon(R.drawable.ic_mensajeweb)
        .setContentTitle(titulo)
        .setContentText(textoAMostrar);
		TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
		stackBuilder.addNextIntent(new Intent());
		PendingIntent resultPendingIntent =
        stackBuilder.getPendingIntent(
            0,
            PendingIntent.FLAG_UPDATE_CURRENT
        );
		mBuilder.setContentIntent(resultPendingIntent);
		nm.notify(idNotificacion, mBuilder.build());	 
	}
}
